package com.winz.cultureapp.adapter;

import android.content.Context;
import android.graphics.Color;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.winz.cultureapp.R;
import com.winz.cultureapp.base.AbsBaseAdapter;
import com.winz.cultureapp.entity.BookStadiumTimeBean;

/**
 * 预定场馆--选择时间段
 */
public class BookStadiumAdapter extends AbsBaseAdapter<BookStadiumTimeBean.DataBean.ListBean>{

    public BookStadiumAdapter(Context context, boolean isNeedToRemember, int resid) {
        super(context, isNeedToRemember, resid);
    }

    @Override
    public void bindDatas(int position, View convertView, ViewHolder viewHolder, BookStadiumTimeBean.DataBean.ListBean data) {
        viewHolder.bindTextView(R.id.tv_time,data.startTime + "-" +data.endTime)
                .bindTextView(R.id.tv_type,data.scheduleStatus==0?"不可预定":data.scheduleStatus==1?"可预定":data.scheduleStatus==3?"已预定":"锁定");

        TextView tv_time = viewHolder.getView(R.id.tv_time);
        TextView tv_type = viewHolder.getView(R.id.tv_type);
        ImageView mIv_sel = viewHolder.getView(R.id.iv_sel);

        tv_time.setTextColor(context.getResources().getColor(data.scheduleStatus==0?R.color.text_66:data.scheduleStatus==1?R.color.base_color:data.scheduleStatus==3?R.color.text_yellow:R.color.icon_red));
        tv_type.setTextColor(context.getResources().getColor(data.scheduleStatus==0?R.color.text_66:data.scheduleStatus==1?R.color.base_color:data.scheduleStatus==3?R.color.text_yellow:R.color.icon_red));

        if (map_isSelected.get(position).isSelected()){
            mIv_sel.setImageResource(R.drawable.icon_cb_sel);
        }else {
            mIv_sel.setImageResource(R.drawable.icon_cb_nor);
        }
    }
}
